home *** CD-ROM | disk | FTP | other *** search
/ Amiga Packmags / NewsFlash - Issue 03 (1989)(UGA - 17-Bit Software)[a].zip / NewsFlash - Issue 03 (1989)(UGA - 17-Bit Software)[a].adf / doc / SamplePlay.DOC < prev    next >
Text File  |  1988-01-19  |  3KB  |  96 lines

  1. --------------------------------------------------------------------------
  2.      SamplePlay+Source ... Created for UGA PD in 1989 By Brian Postma
  3. --------------------------------------------------------------------------
  4. start:    lea        buffer,a1
  5.     subq.l        #2,d0        ;Command Line Empty
  6.     blt        quit        ;Yes ??
  7. copy:    move.b        (a0)+,(a1)+    ;Copy Commandline
  8.     dbra        d0,copy
  9.     clr.b        (a1)        ;End with 0->filename
  10.     lea        dosname,a1    ;Library Name
  11.     move.l        4,a6        ;Execbase
  12.     jsr        -408(a6)    ;Open Library
  13.     move.l        d0,dosbase
  14.     move.l        dosbase,a6
  15.     move.l        #buffer,d1    ;FileName
  16.     move.l        #2,d2        ;Read
  17.     jsr        -84(a6)        ;GetLock
  18.     move.l        d0,handle    ;LockHandle
  19.     beq        quit        ;File Found ??
  20.     move.l        dosbase,a6
  21.     move.l        #block,d2    ;Fileinfo block
  22.     move.l        handle,d1    ;LockHandle
  23.     jsr        -102(a6)    ;Examine
  24.     beq        quit        ;Error ?
  25.     lea        block,a0
  26.     move.l        124(a0),length    ;Fetch length from fileinfo
  27.     move.l        dosbase,a6
  28.     move.l        handle,d1
  29.     jsr        -90(a6)        ;UnLock
  30.     move.l        4,a6        ;Execbase
  31.     move.l        length,d0    ;Length of file
  32.     move.l        #2,d1        ;ChipMem
  33.     jsr        -198(a6)    ;AllocMem
  34.     move.l        d0,memblock    ;Pointer to memory
  35.     beq        quit        ;Error
  36.     move.l        dosbase,a6
  37.     move.l        #1005,d2    ;Mode=OLDFILE
  38.     move.l        #buffer,d1    ;FileName
  39.     jsr        -30(a6)        ;Open
  40.     move.l        d0,handle    ;FileHandle
  41.     beq        quit2        ;Error ??
  42.     move.l        handle,d1    ;FileHandle
  43.     move.l        length,d3    ;FileLength
  44.     move.l        memblock,d2    ;Buffer
  45.     jsr        -42(a6)        ;Read
  46.     move.l        handle,d1    ;FileHandle
  47.     jsr        -36(a6)        ;Close
  48.     move.l        memblock,$dff0a0;Pointer to Sample
  49.     move.l        length,d0    ;Length
  50.     lsr.l        #1,d0        ;Divide by 2->Length in Words
  51.     move.w        d0,$dff0a4    ;Length Sample in words
  52.     move.w        #$1ac,$dff0a6    ;Replay Rate
  53.     move.w        #64,$dff0a8    ;Volume
  54.     move.w        #$8001,$dff096    ;Audio DMA for Voice1 on
  55. wait:    btst        #6,$bfe001    ;MouseButton Pressed
  56.     bne        wait        ;No ??
  57.     move.w        #$1,$dff096    ;Audio DMA for Voice1 off
  58. quit2:    move.l        memblock,a1    ;Memory Pointer
  59.     move.l        length,d0    ;Length in bytes
  60.     move.l        4,a6        ;Execbase
  61.     jsr        -210(a6)    ;Freemem
  62. quit:    clr.l        d0
  63.     rts
  64. ; Some Vars
  65. dosbase:dc.l        0
  66. length:    dc.l        0        ;FileLength
  67. handle:    dc.l        0        ;FileHandle
  68. memblock:dc.l        0
  69. buffer:    blk.b        128,0        ;Command Line Buffer
  70. block:    blk.b        256,0        ;FileInfoBlock buffer
  71. dosname:dc.b        "dos.library",0    ;Name of doslibrary
  72. --------------------------------------------------------------------------
  73. How does this work:
  74. Load the source from this disk with Seka (type 'r<CR>' and 'SamplePlay',
  75. extension .S is not necessary). Type 'a' followed by 2 times RETURN to
  76. assemble the program and type 'wo<CR>' to save the executable object file
  77. to disk. If you have a version 2.0 or higher from seka, you will also be
  78. asked for 'MODE', just press return here.
  79. To execute program type 'SAMPLEPLAY filename' from the CLI. The program
  80. will now load, load the sample named 'filename' and starts playing it.
  81. Press the left mouse button to quit.
  82.  
  83. This program demonstrates in fact 3 things:
  84. -How to use commandlines from assembler.
  85. -How to use the dos functions:Lock,UnLock,Examine,Read,Write,Close.
  86. -How to play a digitized sound.
  87.  
  88. Have fun with it.
  89.  
  90. For questions, complaints, remarks:
  91.  
  92. Brian Postma
  93. J.v.Hartenstraat 51
  94. 7576VX Oldenzaal (NL)
  95. 05410-14763
  96.